<?php

function make_jm_navs($grid,$offset=4){
	$_SERVER ;
	$page = $_SERVER["SCRIPT_NAME"];
	$row_1 = $grid->pageNo * $grid->pageSize + 1 ;
	$row_2 = $row_1 + $grid->pageSize - 1 ;

	if($row_2 > $grid->totalCount){
		$row_2 = $grid->totalCount ;
	}

	$navstr  = "";
	$navstr .= "<center>";
	$navstr .= "<ul id='ul-navs'>";

	$no1 = $grid->pageNo - $offset ;
	$no2 = $grid->pageNo + $offset ;

	if($grid->pageCount > 1){
		for($n=$no1;$n<=$no2;$n++){
			if($n < 0){
				continue ;
			}
			if($n >= $grid->pageCount){
				continue ;
			}
			$no = $n + 1 ;
			$css = ($n == $grid->pageNo) ? "navcurrent" : "" ;
			
			$navstr .= "<li class='$css'>";
			$navstr .= "	<A HREF='$page?grid_page_no=$n' data-transition='slide'>".($no)."</A>";
			$navstr .= "</li>";
			
		}
	}

	$navstr .= "</ul>";
	$navstr .= "</center>";
	$navstr .= "";

	return $navstr ;

}